package cn.com.dingtek.genius.manager.server.repository.db.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xuxueli.poi.excel.annotation.ExcelField;
import com.xuxueli.poi.excel.annotation.ExcelSheet;
import lombok.*;
import lombok.experimental.Accessors;
import org.apache.poi.hssf.util.HSSFColor;

import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ExcelSheet(name = "登录日志", headColor = HSSFColor.HSSFColorPredefined.LIGHT_GREEN)
public class UserLoginLog {
    @ExcelField(name = "编号")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ExcelField(name = "用户ID")
    private Long userId;

    @ExcelField(name = "登录账号")
    private String accountName;

    @ExcelField(name = "登录IP")
    private String ip;

    @ExcelField(name = "登录终端")
    private String agent;

    @ExcelField(name = "操作系统")
    private String os;

    @ExcelField(name = "是否成功")
    private Boolean logState;

    @ExcelField(name = "描述")
    private String remark;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ExcelField(name = "登录时间")
    private Date ctime;
}
